﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.IO;
using TinyEngine;
using TinyEngine.Core;
using TinyEngine.Core.Parsers;
using ThirdPartyPlugins;

namespace TinyGameSample.CustomEntities.Parsers
{
    public class CustomTileGridParser : IEntityParser
    {
        public System.Xml.Linq.XElement ToXmlElement(IEntity obj)
        {
            return null;
        }

        public IEntity FromXmlElement(System.Xml.Linq.XElement element)
        {
            var tileGrid = new CustomTileGridEntity();
            tileGrid.Name = element.Attribute("Name").Value;
            tileGrid.Position = ParserHelper.TryParseVector3("Position", element);
            
            var fileRef = ParserHelper.TryParseString("Ref", element);
            tileGrid.Ref = fileRef;
            return tileGrid;
        }

    }

}
